import icon from '../images/apple.png';
import './cartitem.css';

const CartItem = (props) => {
  const { apple, eatApple } = props
  return (
    <div className="cart-item">
      <div className="apple">
        <img src={icon} alt="" />
      </div>
      <div className="info">
        <div className="name">红苹果 - {apple.id}号</div>
        <div className="weight">{apple.weight}克</div>
      </div>
      <div className="btn-div">
        <button onClick={() => eatApple(apple.id)}> 吃掉 </button>
      </div>
    </div>
  )
}

export default CartItem